import { ApiProperty } from '@nestjs/swagger';
import { IsEnum, IsNotEmpty, IsOptional } from 'class-validator';

export class CreatePostDto {
  @ApiProperty({ description: '公共消息标题', example: '消息标题' })
  @IsNotEmpty({ message: '标题不能为空' })
  title: string;
  @ApiProperty({ description: '公共消息简介', example: '消息简介' })
  @IsOptional()
  intro: string;
  @ApiProperty({ description: '公共消息图片', example: '消息图片' })
  @IsOptional()
  coverImage: string;
  @ApiProperty({ description: '公共消息内容', example: '消息内容' })
  @IsOptional()
  content: string;
  @ApiProperty({ description: '创建者', example: '5T技术部' })
  @IsOptional()
  createBy: string;
  @ApiProperty({ description: '跳转地址', example: '' })
  @IsOptional()
  targetUrl: string;
  @ApiProperty({ description: '类型', example: 'broadcast' })
  @IsNotEmpty({ message: '消息类型不能为空' })
  @IsEnum(['broadcast', 'flow']) // broadcast：广播 ， flow： 流程
  type: string;
}
